<?php

// use Illuminate\Support\Facades\Schema;
use Jialeo\LaravelSchemaExtend\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class InitUserVip extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('vip_skus', function (Blueprint $table) {
            $table->comment = 'vip sku表';
            
            $table->increments('id');
            $table->uuid('uuid')->index() ;

            $table->string('thumb')->comment('封面');
            $table->string('title')->comment('标题');
            $table->integer('days')->comment('vip时长天数');

            $table->integer('stock')->default(0)->comment('库存');
            $table->integer('sales')->default(0)->comment('销量');

            $table->integer('money_price')->nullable()->comment('人民币价格');
            $table->integer('score_price')->nullable()->comment('积分价格');

            $table->integer('discount_money_price')->nullable()->comment('促销价格人民币');
            $table->integer('discount_score_price')->nullable()->comment('俏销积分价格');

            $table->integer('brokerage_money')->unsigned()->nullable()->comment('推广红包奖励');   // 售价
            $table->integer('brokerage_score')->unsigned()->nullable()->comment('推广积分奖励');   // 售价
            $table->integer('second_brokerage_money')->unsigned()->nullable()->comment('上级推广人红包佣金');   // 售价
            $table->integer('second_brokerage_score')->unsigned()->nullable()->comment('上级推广人积分佣金');   // 售价
 
            $table->integer('reward_money')->unsigned()->nullable()->comment('商品奖励红包');  
            $table->integer('reward_score')->unsigned()->nullable()->comment('商品奖励积分'); 

            $table->integer('list_weight')->default(99)->comment('权重');

            $table->boolean('status')->default(1)->index()->comment('1为上架中,  0为下架中');

            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::disableForeignKeyConstraints();
        Schema::dropIfExists('vip_skus');
    }
}
